home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
FROMUTS
/
BOMBS
/
!Bombs
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1993-03-24
|
13KB
|
569 lines
> !RunImage
new_sprites%=
$+" at line "+
"Wimp_Poll",grabkey%
1,poll
grabkey%
grabkey
redraww
openw
closew
exitw
enterw
click
enddrag
menuselect
losec
gainc
17,18,19:
message
$;" at line ";
-isize%=512:menusize%=512:spritesize%=4096
string isize%,menu menusize%,menuh%(2),blk 1024,poll 256,handle%(9),subptr%(4),task 24,game 320<<10,sprites% spritesize%
$blk="TASK":$task="Bombs"
"Wimp_Initialise",200,blk!0,$task
,task%
"eblk!0=-1:blk!4=0:blk!8=0:blk!12=64:blk!16=68:blk!20=(7<<28)+(3<<12)+(1<<4)+10:$(blk+24)="!"+$task
"Wimp_CreateIcon",,blk
iconbar%
"Wimp_SlotSize",-1,-1
appsize%
%0string%=string:menu%=menu:inerr%=
:ingame%=
"Wimp_CloseTemplate":
"Wimp_OpenTemplate",,"<"+$task+"$Dir>.Templates"
loadwin("infobox",0,-1)
loadwin("options",1,sprites%)
loadwin("keydef",2,sprites%)
loadwin("highs",3,-1)
loadwin("name",4,-1)
"Wimp_CloseTemplate"
blk!0=handle%(1)
/$blk!4=1:blk!8=1<<21:blk!12=1<<21
"Wimp_SetIconState",,blk
1Dsprites%!0=spritesize%:sprites%!4=0:sprites%!8=16:sprites%!12=16
"OS_SpriteOp",256+10,sprites%,"<"+$task+"$Dir>.WimpSpr"
3"grabkey%=0:paused%=
:ingame%=
crmenu(1,"Keys/s2Define keys/Save keys/")
new_sprites%
crmenu(0,$task+"/s0Info/s1Options/sm1Keys/s3Highscores/Play/dContinue/dNew sprites/Quit/")
crmenu(0,$task+"/s0Info/s1Options/sm1Keys/s3Highscores/Play/dContinue/Quit/")
"OS_File",5,"<Bombs$Dir>.GameCode"
ex%=0
ex%=2
1,"Can't find main code"
"OS_File",&FF,"<Bombs$Dir>.GameCode",game
"OS_File",5,"<Bombs$Dir>.GameSpr"
ex%,,,,game!(game!32)
ex%=0
ex%=2
1,"Can't find sprites"
"OS_File",&FF,"<Bombs$Dir>.GameSpr",game+game!12+game!(game!20)
"OS_File",5,"<Bombs$Dir>.Levels.Default"
fileok%=(ex%=1)
"XOS_File",&FF,"<Bombs$Dir>.Levels.Default",game+game!12
"OS_File",5,"<Bombs$Dir>.Keys"
ex%,,,,len%
ex%=1
len%=6
ptr%=game+game!8
"OS_File",&FF,"<Bombs$Dir>.Keys",ptr%
icon%=0
A%,$(blk+256)
A%=ptr%?icon%
A%=&FF
icon%<2
getstr(handle%(2),1-icon%+6)=$(blk+256)
getstr(handle%(2),icon%+6)=$(blk+256)
"OS_File",5,"<Bombs$Dir>.High"
A%=1
"OS_File",&FF,"<Bombs$Dir>.High",blk+512
ptr%=blk+512
icon%=0
getstr(handle%(3),icon%*2)=$ptr%
ptr%+=
$(ptr%)+1
getstr(handle%(3),icon%*2+1)=
(ptr%?0+ptr%?1*256+ptr%?2*256*256)
ptr%+=3
hi%=0
getstr(handle%(3),hi%*2)=
(hi%+1)+" --------"
getstr(handle%(3),hi%*2+1)=
(4000+4000*(4-hi%))
loadwin($poll,n%,area%)
"Wimp_LoadTemplate",,blk,string%,string+isize%,-1,poll
,,string%,,,,ok%
ok%=0
err("Template "+$poll+" not found",2)
area%<>-1
blk!64=area%
"Wimp_CreateWindow",,blk
handle%(n%)
redraww
openw
"Wimp_OpenWindow",,poll
closew
"Wimp_CloseWindow",,poll
exitw
poll!0=handle%(2)
grabkey%=0
enterw
poll!0=handle%(2)
grabkey%=1
click
(poll!8
4)<>0
poll!12
paused%
continue
handle%(1)
poll!16
0,1,2
blk!0=poll!12:blk!12=1<<21
icon%=0
blk!4=icon%
blk!8=-(icon%=poll!16)<<21
"Wimp_SetIconState",,blk
(poll!8
2)<>0
poll!12
openmenu(0,poll!0-96,96+height%)
(poll!8
1)<>0
(poll!8
&10)<>0
(poll!8
&40)<>0
enddrag
poll!0
handle%(1)
oldic%=poll!4
poll!24
13,&18E
poll!4+=1
poll!4=7
poll!24=13
"Wimp_CreateMenu",,-1:
play
setc(poll!0,poll!4)
&18F
poll!4-=1
poll!4=4
poll!4=6
setc(poll!0,poll!4)
handle%(4)
poll!24
getstr(handle%(3),hi%*2)+=$
getstr(handle%(4),2)
ptr%=blk+512
icon%=0
&$ptr%=$
getstr(handle%(3),icon%*2)
ptr%+=
$ptr%+1
*ptr%!0=
getstr(handle%(3),icon%*2+1)
ptr%+=3
"OS_File",10,"<Bombs$Dir>.High",&FFD,,blk+512,ptr%
"Wimp_CreateMenu",,-1
menuselect
"Wimp_DecodeMenu",,menuh%(menuh%),poll,blk
subptr%(0)=blk
A%=-1
A%+=1
subptr%(A%+1)=subptr%(A%)
subptr%(A%+1)+=1
?subptr%(A%+1)=
?subptr%(A%+1)=&D
?subptr%(A%+1)=
?subptr%(A%+1)=13:subptr%(A%+1)+=1
?subptr%(A%+1)=&D
$(blk+256)=$menuh%(menuh%)
$(blk+256)
$task
$subptr%(0)
"Keys"
$subptr%(1)
"Save keys"
"OS_File",10,"<Bombs$Dir>.Keys",&FFD,,game+game!8,game+game!8+6
"Play"
"Continue"
continue
"New sprites"
"Wimp_StartTask","/<Bombs$Dir>.Code.GetSprs"
paused%=
"OS_File",5,"<Bombs$Dir>.GameSpr"
ex%,,,,len%
ex%=0
ex%=2
1,"Can't find sprites"
game!(game!32)=len%
"OS_File",&FF,"<Bombs$Dir>.GameSpr",game+game!12+game!(game!20)
"Quit":
"Wimp_GetPointerInfo",,blk
(blk!8
1)=1
openmenu(menuh%,menux%,menuy%)
losec
gainc
message
taskref%=poll!4:ref%=poll!8
poll!16
poll!40<>&FFD
err("This is not a data file",1)
bufsize%=poll!36
bufsize%>game!(game!20)
err("File too big",1)
bufsize%=-1
bufsize%=game!(game!20)
buf=game+game!12
poll!20=buf
poll!24=bufsize%
saveptr%=0
reply(18,6)
paused%=
"Wimp_GetPointerInfo",,blk
poll!12=0
"OS_File",5,poll+44
blk!0,,blk!4,,blk!8
blk!0=1
(blk!4>>>8)=&FFFFFD
blk!8>game!(game!20)
err("File too big",1)
"OS_File",&FF,poll+44,game+game!12
$blk=""
icon%=0
$blk+=
game?(game!12+icon%)
fileok%=($blk="Level_File")
paused%=
fileok%
err("This is not a level file !",1)
fileok%
blk!12=0
fileok%=
err("This file contains no levels!",1)
reply(17,4)
err("This is not a data file",1)
saveptr%+=poll!24
saveptr%>bufsize%
%bufsize%+=game!(game!20)-saveptr%
poll!20=buf+saveptr%
poll!24=bufsize%-saveptr%
saveptr%>=game!(game!20)
err("File too big",1)
fileok%=
paused%=
reply(18,6)
$blk=""
icon%=0
$blk+=
game?(game!12+icon%)
fileok%=($blk="Level_File")
fileok%
err("This is not a level file !",1)
fileok%
blk!12=0
fileok%=
err("This file contains no levels!",1)
reply(17,4)
&400C0
poll!20
handle%(1)
&43F40
1<<17
blk!0=poll!20
blk!4=2
blk!8=(F%
1)<<22
blk!12=1<<22
"Wimp_SetIconState",,blk
"Wimp_CreateSubMenu",,poll!20,poll!24,poll!28
openmenu(h%,x%,y%)
C!menuh%=h%:menux%=x%:menuy%=y%
grey(0,"Play",
fileok%)
grey(0,"Continue",
(paused%
fileok%))
"Wimp_CreateMenu",,menuh%(menuh%),menux%,menuy%
grey(h%,$(blk+512),set%)
ptr%=menuh%(h%)+28
(ptr%!8
256)=256
ptr2%=ptr%!12
ptr2%=ptr%+12
ptr%+=24
$ptr2%=$(blk+512)
ptr%-=24
P-ptr%!8=ptr%!8
(1<<22)
-(set%<>0)<<22
err($(blk+4),?blk)
inerr%
inerr%=
ingame%
"Wimp_SetMode",mode%
?blk
2:$(blk+4)="Fatal error: "+$(blk+4)+" - "+$task+" is terminating"
3:$(blk+4)+=" - (Cancel to quit)"
"Wimp_ReportError",blk,?blk,$task
,?blk
(?blk
inerr%=
"Wimp_CloseDown",,task%
crmenu(handle%,$blk)
item=blk+256:val=blk+512
f"$item=
$blk,
$blk,"/")-1),12)
max%=
$item
$menu%=$item
$blk=
$blk,
$item+2)
menu%?12=7
menu%?13=2
menu%?14=7
menu%?15=0
menu%!16=172
menu%!20=44
menu%!24=0
ptr%=menu%+28
dotted%=0
menuitems%=0
menuitems%+=1
v#grey%=0:tick%=0:dot%=0:write%=0
w!validate%=0:sub%=-1:centre%=0
ptr%-menu>menusize%-24
err("Not enough menu space",2)
found%=
$blk,1)
"g":grey%=1<<22:
"t":tick%=1:
"d":dot%=2:dotted%+=1:
"c":
next:centre%=centre%
"s":
next:sub%=1
$blk,1,1)="m"
next:sub%+=1
$item=""
$blk,1,1)>="0"
$blk,1,1)<="9"
$item+=
$blk,1,1)
$blk=
$blk,2)
sub%=1
sub%=handle%(
$item)
sub%=menuh%(
$item)
"v":validate%=1:
$val=""
$blk,1,1)<>","
$blk<>""
$val+=
$blk,1,1)
$blk=
$blk,2)
$blk=
$blk,2)
"w":write%=1:
$item=""
$blk,1,1)<>","
$blk<>""
$item+=
$blk,1,1)
$blk=
$blk,2)
$blk=
$blk,2)
writelen%=
$item
found%=
$item=
$blk,
$blk,"/")-1)
write%
$item>12
validate%
write%=0
writelen%=
$item
ptr%!12=string%
ptr%!20=writelen%+1
string%+=writelen%+1
validate%
ptr%!16=string%:string%+=1+
$val
ptr%!16=-1
string%>string+isize%
err("Not enough string space",2)
$ptr%!12=$item
validate%
$ptr%!16=$val
$item>max%
write%=0
max%=
$item
indirect%=1
$(ptr%+12)=$item
$item>max%
max%=
$item
indirect%=0
$blk=
$blk,
$blk,"/")+1)
>ptr%!0=tick%
dot%
write%<<2
1<<3
(&80
($blk=""))
ptr%!4=sub%
Vptr%!8=grey%
(indirect%
validate%)<<8
&10021
write%<<3
centre%<<3
7<<24
ptr%+=24
$blk=""
menu%!16=(max%+2)*16
menuh%(handle%)=menu%
$menu%=$task
height%=44*menuitems%+24*dotted%
menu%+=28+24*menuitems%
$blk=
$blk,2)
found%=
*** Library routines and main program ***
reply(type%,poll!16)
poll!12=ref%
"Wimp_SendMessage",type%,poll,taskref%
setc(wh%,icon%)
"Wimp_SetCaretPosition",wh%,icon%,0,-1,-1,
getstr(wh%,icon%)
getstr(win%,icon%)
blk!0=win%:blk!4=icon%
"Wimp_GetIconState",,blk
(blk!24
256)<>0
=blk!28
=blk+28
ptr%=game
~game!(ptr%!28)
icon%=-1
icon%+=1
getstr(handle%(3),icon%*2+1)
icon%=4
getstr(handle%(3),icon%*2+1)
icon%<4
T%=4
icon%+1
getstr(handle%(3),T%*2)+2)=$(
getstr(handle%(3),T%*2-2)+2)
getstr(handle%(3),T%*2+1)=$
getstr(handle%(3),T%*2-1)
getstr(handle%(3),icon%*2+1)=
getstr(handle%(3),icon%*2)=
(icon%+1)+" "
hi%=icon%
getstr(handle%(4),2)=""
"Wimp_CreateMenu",,handle%(4),640,512
"Pointer 1":
fileok%
ptr%=game
getstr(handle%(1),5)
l%=-1
f%=game+ptr%!12
?game!(ptr%!0)=(m%
100)<<8
(m%
10)<<4
(m%
getstr(handle%(1),6)
?game!(ptr%!4)=(m%
100)<<8
(m%
10)<<4
(m%
mode%=
icon%=-1
icon%+=1
blk!0=handle%(1):blk!4=icon%
"Wimp_GetIconState",,blk
(blk!24
1<<21)
game?(ptr%!24)=icon%
icon%=0
"OS_SpriteOp",256+36,sprites%,"cursor",2
3<<5,7,5
ingame%=
(game+512)
ingame%=
paused%=(R%=3)
"Wimp_SetMode",mode%
paused%
continue
"Pointer 1":
fileok%
ptr%=game
mode%=
icon%=-1
icon%+=1
blk!0=handle%(1):blk!4=icon%
"Wimp_GetIconState",,blk
(blk!24
1<<21)
game?(ptr%!24)=icon%
icon%=0
"OS_SpriteOp",256+36,sprites%,"cursor",2
3<<5,7,5
ingame%=
(game+128)
ingame%=
paused%=(R%=3)
"Wimp_SetMode",mode%
paused%
grabkey
"Wimp_GetPointerInfo",,blk
"OS_Byte",&79
,pressed%
pressed%<>&FF
blk!16<>-1
blk!16<12
icon%=blk!16
A%,$(blk+256)
A%=&FF
A%=pressed%
item%=0
$(blk+256)=$
getstr(handle%(2),item%+6)
item%=255
item%<255
A%<>&FF
getstr(handle%(2),icon%+6)=$(blk+256)
!"blk!0=handle%(2):blk!4=icon%+6
blk!8=0:blk!12=0
"Wimp_SetIconState",,blk
ptr%=game
icon%<2
icon%=1-icon%
game?(ptr%!8+icon%)=A%
65,"A", 100,"B", 82,"C", 50,"D", 34,"E", 67,"F", 83,"G", 84,"H", 37,"I", 69,"J", 70,"K", 86,"L", 101,"M", 85,"N", 54,"O", 55,"P", 16,"Q", 51,"R", 81,"S", 35,"T", 53,"U", 99,"V", 33,"W", 66,"X", 68,"Y", 97,"Z"
48,"1", 49,"2", 17,"3", 18,"4", 19,"5", 24,"6", 36,"7", 21,"8", 38,"9", 39,"0", 45,"`", 23,"-", 93,"=", 46,"
", 56,"[", 88,"]", 120,"\", 72,";", 79,"'", 102,",", 103,".", 104,"/" ,98,"Space"
32,"Print", 113,"f1", 114,"f2", 115,"f3", 20,"f4", 116,"f5", 117,"f6", 22,"f7", 118,"f8", 119,"f9", 30,"f10", 28,"f11", 29,"f12"
107,"Keypad 1", 124,"Keypad 2", 108,"Keypad 3", 122,"Keypad 4", 123,"Keypad 5", 26,"Keypad 6", 27,"Keypad 7", 42,"Keypad 8", 43,"Keypad 9", 106,"Keypad 0"
74,"Keypad /", 91,"Keypad *", 90,"Keypad #", 59,"Keypad -", 58,"Keypad +", 76,"Keypad .", 60,"Keypad Enter", 77,"Num Lock"
112,"Escape", 31,"Scroll Lock", 44,"Break", 61,"Insert", 62,"Home", 63,"Page Up", 89,"Delete", 105,"Copy", 78,"Page Down", 73,"Enter", 47,"BackSpace", 96,"Tab", 1,"CTRL", 0,"Shift", 64,"Caps Lock", 2,"Alt", 57,"Up", 25,"Left", 41,"Down", 121,"Right"
&FF,"Unknown !"